package com.jeeplus.test.jlnu.archivalInfo.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.AdmissionInfo;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.AllInfo;
import com.jeeplus.test.jlnu.archivalInfo.domain.entity.ArchParmerter;
import com.jeeplus.test.jlnu.archivalInfo.domain.entity.ArchivalInfo;
import com.jeeplus.test.jlnu.archivalInfo.domain.entity.HangErrorEntity;
import com.jeeplus.test.jlnu.archivalInfo.domain.vo.ArchivalInfoExcelVO;
import com.jeeplus.test.jlnu.archivalInfo.domain.vo.ArchivalInfoReqVo;
import com.jeeplus.test.jlnu.fieldConfig.domain.FieldConfigEntity;
import com.jeeplus.test.jlnu.graduationInfo.domain.entity.NewGraduationInfo;
import com.jeeplus.test.postgraduate.domain.vo.PostgraduateReqVo;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface ArchivalInfoMapper {

   //todo 第一个判断每个参数是否为空 为空就不查了 不然报错
   Page<ArchivalInfoReqVo> getArchivalInfoPage(@Param("archivalInfoReqVo") ArchivalInfoReqVo archivalInfoReqVo, Page<ArchivalInfoReqVo> page);


   int updateArchival(ArchivalInfoReqVo archivalInfoReqVo);

   @Select("select count(*) from jlnu_admission_info where student_id = #{studentId}")
    int checkStuId(String studentId);

   void addArchival(ArchivalInfoReqVo archivalInfoReqVo);

   @Insert("INSERT INTO jlnu_admission_info (page_location,file_title,archival_num, case_title,postal_code, learning_forms,educational_system,gradation,political_outlook,birthday,examinee_num,student_id, name,admission_time, save_location, remarks, admission_major, nation, gender, source_area, admission_num, id_card, admission_academy )\n" +
           "VALUES\n" +
           "  (#{pageLocation},#{fileTitle},#{archivalNum},#{caseTitle},#{postalCode},#{learningForms},#{educationalSystem},#{gradation},#{politicalOutlook},#{birthday},#{examineeNum},#{studentId},#{name},#{grade},#{saveLocation},#{remarks},#{admissionMajor},#{nation},#{gender},#{sourceArea},#{admissionNum},#{idCard},#{admissionAcademy})")
   void addAddmissionStuId(ArchivalInfoReqVo achivalInfoReqVo);

   List<Map<String,String>> selectArchivalInfo(String studentId);

   void addDataArch(List<ArchivalInfoExcelVO> dataList);

   List<ArchivalInfoReqVo> getStuIdAndMaterialId();

   void batchInsertFailedFiles(List<HangErrorEntity> errorRecords);

   List<HangErrorEntity> getFailedFiles(@Param("offset") int offset, @Param("limit") int limit,@Param("officeId") String officeId);
   int countFailedFiles(@Param("officeId")String officeId); // 统计总数

   ArchivalInfoReqVo getArchivalInfoById(Integer infoId);

   List<Map<String, String>> querylist(Map param);

   List<AdmissionInfo> selectAllByOfficeId(ArchivalInfoReqVo archivalInfoReqVo);
   int batchUpdateArchiva(@Param("archivalInfoReqVos") List<ArchivalInfoReqVo> archivalInfoReqVos,@Param("transferState") String transferState);


   int batchUpdateArchivalInfo(@Param("admissionInfos") List<AdmissionInfo> admissionInfos, @Param("transferState") String transferState);

   int batchUpdateById(@Param("ids") List<String> ids,@Param("changeStuInfo") ArchivalInfo archivalInfo);

}
